package com.itheima.网络编程.tcp编程.tcp编程.文件上传线程池;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class 文件上传服务端二 {
    public static void main(String[] args) throws IOException {
        ServerSocket ss = new ServerSocket(10001);
        ThreadPoolExecutor tp = new ThreadPoolExecutor(3, 10,
                60, TimeUnit.SECONDS, new ArrayBlockingQueue<>(5),
                Executors.defaultThreadFactory(), new ThreadPoolExecutor.AbortPolicy());
        while (true) {
            Socket sk = ss.accept();
            ThreadCs threadCs = new ThreadCs(sk);
            tp.submit(threadCs);
        }
        //ss.close();
    }
}
